package org.stvd.common.enums;

import java.util.LinkedHashMap;

/**
 * @Title: AuthRoleEnum
 * @Description: 平台内建认证角色枚举类
 * @author houzx
 * @date 2020年10月10日
 */
public enum AuthRoleEnum {
    
    /** 认证实名用户：ROLE_PERSON */
    PERSON("实名用户","ROLE_PERSON"),
    
    /** 认证专家用户：ROLE_EXPERT */
    EXPERT("专家用户","ROLE_EXPERT"),
    
    /** 认证团队用户：ROLE_TEAM */
    TEAM("团队用户","ROLE_TEAM"),
    
    /** 认证企业用户：ROLE_COMPANY */
    COMPANY("企业用户","ROLE_COMPANY");

    // 成员变量
    private String text;
    private String value;

    // 构造方法
    private AuthRoleEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    public String getText() {
        return text;
    }

    public String getValue() {
        return value;
    }

    public static String getName(String value) {
        for (AuthRoleEnum roleStr : AuthRoleEnum.values()) {
            if (value.equals(roleStr.getValue())) {
                return roleStr.getText();
            }
        }
        return null;
    }

    public static LinkedHashMap<String, String> authRoleMap = new LinkedHashMap<String, String>();
    static {
        for (AuthRoleEnum authRole : AuthRoleEnum.values()) {
            authRoleMap.put(authRole.getValue(), authRole.getText());
        }
    }
}
